@inject IOptions<AutorouteOptions> AutorouteOptions

@using OrchardCore.ContentManagement

@{
    ContentItem contentItem = Model.ContentItem;
    var menuItemPart = contentItem.As<ContentMenuItemPart>();
    var routeValues = new RouteValueDictionary(AutorouteOptions.Value.GlobalRouteValues);
    routeValues[AutorouteOptions.Value.ContentItemIdKey] = menuItemPart.ContentItem.Content.ContentMenuItemPart.SelectedContentItem.ContentItemIds[0];
    var linkUrl = Url.RouteUrl(routeValues);
}

<a href="@linkUrl">@menuItemPart.Name</a>
